package com.hanter.rad.widget.cupertino.utils;

import android.os.Build;
import android.support.v4.app.DialogFragment;
import android.view.Window;

import com.hanter.pickerview.utils.R;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

/**
 * 透明状态栏的Dialog
 */
public class BaseDialog extends DialogFragment {


    public BaseDialog() {
        super();
        setStyle(DialogFragment.STYLE_NO_FRAME, R.style.BasePickerDialog);
    }

    @Override
    public void onStart() {
        super.onStart();

        Window window = getDialog().getWindow();

        if (window != null) {
            int suv = window.getDecorView().getSystemUiVisibility();
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                suv |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
            }
            window.getDecorView().setSystemUiVisibility(suv);
        }
    }

}
